package org.abc.commom.util;

/**
 * @Description:
 * @author dingzhiwei jmdhappy@126.com
 * @date 2017-07-05
 * @version V1.0
 * @Copyright: www.xxpay.org
 */
public class MyLogFace implements MyLogInf {

    private org.slf4j.Logger 				ABC_LOG = null;
    public void setName(String clz) { 		ABC_LOG = org.slf4j.LoggerFactory.getLogger(clz);	}

    public boolean isDebugEnabled() { return ABC_LOG.isDebugEnabled();		}
    public boolean isInfoEnabled() 	{ return ABC_LOG.isInfoEnabled();   	}
    public boolean isWarnEnabled() 	{ return ABC_LOG.isWarnEnabled();		}
    public boolean isErrorEnabled() { return ABC_LOG.isErrorEnabled();		}
    public boolean isTraceEnabled() { return ABC_LOG.isTraceEnabled();		}

    public void trace(String message, Object... args) {
        if (this.isTraceEnabled()) {
            ABC_LOG.trace(message, args);
        }
    }

    @Override
    public void debug(String message, Object... args) {
        if (this.isDebugEnabled()) {
            ABC_LOG.debug(message, args);
        }
    }

    @Override
    public void info(String message, Object... args) {
        if (this.isInfoEnabled()) {
            ABC_LOG.info(message, args);
        }
    }

    @Override
    public void warn(String message, Object... args) {
        if (this.isWarnEnabled()) {
            ABC_LOG.warn(message, args);
        }
    }

    public void error(String message, Object... args) {
        if (this.isErrorEnabled()) {
            ABC_LOG.error(message, args);
        }
    }

    @Override
    public void error(Throwable e, String message, Object... args) {
        if (this.isErrorEnabled()) {
            ABC_LOG.error(String.format(message, args), e);
        }
    }
    //------------------
    public void error(Throwable e, String message) {//简化版
        if (this.isErrorEnabled()) {
            ABC_LOG.error(message + e.toString(), e);
        }
    }

}
